export const routes = [
  {
    path: '/',
    redirect: '/product',
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: 'product',
        component: () => import('@/views/product/index.vue'),
        meta: {
          title: 'tabbar.product',
          keepAlive: false,
        },
      },
      {
        path: 'member',
        component: () => import('@/views/member/index.vue'),
        meta: {
          title: 'tabbar.member',
          keepAlive: true,
        },
      },
      {
        path: 'order',
        component: () => import('@/views/order/index.vue'),
        meta: {
          title: 'tabbar.order',
          keepAlive: true,
        },
      },
      {
        name: 'orderCreate',
        path: '/order/create',
        component: () => import('@/views/order/create.vue'),
        meta: {
          title: 'order.create',
          border: false,
        },
      },
      {
        name: 'orderDetail',
        path: '/order/detail',
        component: () => import('@/views/order/detail.vue'),
        meta: {
          title: 'order.detail',
          border: false,
        },
      },
      {
        name: 'orderUpdate',
        path: '/order/update',
        component: () => import('@/views/order/update.vue'),
        meta: {
          title: 'order.updateOrder',
          border: false,
        },
      },
      {
        name: 'orderSupplement',
        path: '/order/supplement',
        component: () => import('@/views/order/supplement.vue'),
        meta: {
          title: 'order.supplement',
          border: false,
        },
      },
      {
        name: 'orderPay',
        path: '/order/pay',
        component: () => import('@/views/order/pay.vue'),
        meta: {
          title: 'order.pay',
          border: false,
        },
      },
      {
        name: 'orderOnlinePay',
        path: '/order/online-pay',
        component: () => import('@/views/order/online-pay.vue'),
        meta: {
          title: '线上支付',
          border: false,
        },
      },
    ],
  },
  {
    name: 'login',
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '',
      keepAlive: true,
    },
  },
  // 匹配不到重定向会主页
  {
    // 找不到路由重定向到404页面
    path: '/:pathMatch(.*)',
    redirect: '/product',
  },
];

export default routes;
